<template>
  <view>
    <view class="article-card">
      <view class="article-card-img-wrap">
        <image
          class="article-card-img"
          :src="formatImgUrl(info.coverImgUrl)"
          mode="aspectFill"
          :style="{ background: '#eee' }"
        />
      </view>
      <view class="article-card-content">
        <view class="article-card-title">{{ info.articleName }}</view>
        <view class="article-card-desc">{{ info.remark }}</view>
      </view>
    </view>
    <view class="article-card-divider"></view>
  </view>
</template>

<script>
  import { formatImgUrl } from '../common/utils.js'
  export default {
    name: 'ArticleCard',
    props: {
      info: Object
    },
    methods: {
      formatImgUrl
    }
  }
</script>

<style lang="scss" scoped>
  .article-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    background: #fff;
    margin: 20rpx 30rpx;
    overflow: hidden;
  }
  .article-card-img-wrap {
    height: 160rpx;
    background: #eee;
    border-radius: 12rpx;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .article-card-img {
    width: 260rpx;
    height: 160rpx;
    object-fit: cover;
    display: block;
  }
  .article-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: 28rpx;
    min-width: 0;
  }
  .article-card-title {
    font-weight: 600;
    font-size: 34rpx;
    color: #333333;
    margin-bottom: 12rpx;
    word-break: break-all;
  }
  .article-card-desc {
    font-size: 24rpx;
    color: #666666;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-all;
  }
  .article-card-divider {
    height: 1rpx;
    background: #eaeaea;
    margin: 0 30rpx;
  }
</style>
